<?php
/**
 * This file belongs to huakaili project
 *
 * @author jszhang
 */
require_once ( LIB_DIR.'classes/Pager.php' );
global $platformList, $type, $groupid, $reviewDao, $reviewRankInfo;

$pageVars = array();
$errmsg = GetMessageStack();

$shopDao = GetShopDAO();


$page = 1;
if( isset ($_GET['p'])) {
    $page = intval( $_GET['p']) == 0?1:intval( $_GET['p']);
}

//if(isset($_GET['gid']))
//    $groupid = GET( "gid" );
//else
//    edp_redirect(edp_href_link(PAGENAME_REVIEW_RANK));

$styleArr = array();
$msgArr = array();
if( $type == "red" )
{
    $styleArr[0] = "order_box_r";
    $styleArr[1] = "bc_r";
    $msgArr[0] = "好";
    
    $pageVars['reviews'] = $reviewDao->GetReviewRankById( $groupid, true, COMMENT_PER_PAGE, $page );
    $reviewCount = $reviewDao->GetReviewRankCountById( $groupid, true );
}
else if( $type == "black" ){
    $styleArr[0] = "order_box_b";
    $styleArr[1] = "bc_b";
    $msgArr[0] = "差";

    $pageVars['reviews'] = $reviewDao->GetReviewRankById( $groupid, false, COMMENT_PER_PAGE, $page );
    $reviewCount = $reviewDao->GetReviewRankCountById( $groupid,false );
}

$currentURL = htmlspecialchars( $_SERVER["REQUEST_URI"] );
$currentURL = preg_replace( '/&p=[0-9]+/', "", $currentURL );

// prepare page bar of search result
$pageObj = new Pager($currentURL, $reviewCount, COMMENT_PER_PAGE, $page, UP_RESULT_PAGE );
$pageVars['pagebar'] = $pageObj->getBar();

?>
